[PHP] Remove HTML tag except some tag from text string Turn Back
2017-03-08 11:20:30
function remTag($text)
{
$text = strip_tags($text, '', <p>); // Kill all except <p> tag
$text = preg_replace('#<p class="some">(.*?)</p>#', '', $text); // Remove some element by class name
return preg_replace('/class=".*?"/', '', $text); // Remove class name
}